package com.baidu.lib_home.fragment

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView.Orientation
import com.baidu.lib_common.base.BaseFragment
import com.baidu.lib_common.base.BaseRecyclerViewAdapter
import com.baidu.lib_common.utils.getStatusBarHeight
import com.baidu.lib_home.R
import com.baidu.lib_home.adapter.ChartAdapter
import com.baidu.lib_home.databinding.FragmentHomeBinding
import com.baidu.lib_leancloud.LeanCloudManager

class HomeFragment: BaseFragment<FragmentHomeBinding>() {
    override fun initUI(savedInstanceState: Bundle?) {
        super.initUI(savedInstanceState)
        val adapter = ChartAdapter()
        mBinding.root.setPadding(0, getStatusBarHeight(requireContext()),0,0)
        mBinding.recyclerView.adapter = adapter
        mBinding.recyclerView.layoutManager = LinearLayoutManager(requireContext())
        LeanCloudManager.instance.chartMusicModelList.observe(this){modelList ->
            adapter.setNewData(modelList)
        }
    }
}